home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / misc1 / iv26_w30.zip / INTERVIE / WORLD.H < prev    next >
C/C++ Source or Header  |  1992-03-10  |  5KB  |  159 lines

  1. /*
  2.  * Copyright (c) 1987, 1988, 1989 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and its
  5.  * documentation for any purpose is hereby granted without fee, provided
  6.  * that the above copyright notice appear in all copies and that both that
  7.  * copyright notice and this permission notice appear in supporting
  8.  * documentation, and that the name of Stanford not be used in advertising or
  9.  * publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.  Stanford makes no representations about
  11.  * the suitability of this software for any purpose.  It is provided "as is"
  12.  * without express or implied warranty.
  13.  *
  14.  * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  15.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  17.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  18.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  19.  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  20.  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21.  */
  22.  
  23. /*
  24.  * Root scene for a display.
  25.  */
  26.  
  27. #ifndef world_h
  28. #define world_h
  29.  
  30. #include <InterViews/scene.h>
  31.  
  32. /*
  33.  * ParseGeometry return values contains one or more of these bits set.
  34.  */
  35.  
  36. #define GeomNoValue 0x00
  37. #define GeomXValue 0x01
  38. #define GeomYValue 0x02
  39. #define GeomWidthValue 0x04
  40. #define GeomHeightValue 0x08
  41. #define GeomAllValues 0x0F
  42. #define GeomXNegative 0x10
  43. #define GeomYNegative 0x20
  44.  
  45. class PropertyData {
  46. public:
  47.     const char* path;
  48.     const char* value;
  49.     const char* type;
  50. };
  51.  
  52. enum OptionStyle {
  53.     OptionPropertyNext,        /* Property and value are in argv[i+1]  */
  54.     OptionValueNext,        /* argv[i+1] */
  55.     OptionValueImplicit,    /* OptionDesc.value */
  56.     OptionValueIsArg,        /* argv[i] */
  57.     OptionValueAfter        /* &argv[i][strlen(OptionDesc.name)] */
  58. };
  59.  
  60. class OptionDesc {
  61. public:
  62.     const char* name;
  63.     const char* path;
  64.     OptionStyle style;
  65.     const char* value;
  66. };
  67.  
  68. class World : public Scene {
  69. public:
  70.     World(const char* classname, int& argc, char* argv[]);
  71.     World(const char* classname, OptionDesc*, int& argc, char* argv[]);
  72.     World(
  73.     const char* classname, PropertyData*, OptionDesc*,
  74.     int& argc, char* argv[]
  75.     );
  76.     /* obsolete -- use one of above constructors */
  77.     World(const char* instance = nil, const char* device = nil);
  78.     ~World();
  79.  
  80.     void InsertPopup(Interactor*);
  81.     void InsertPopup(
  82.     Interactor*, Coord x, Coord y, Alignment = BottomLeft
  83.     );
  84.  
  85.     void InsertTransient(Interactor*, Interactor*);
  86.     void InsertTransient(
  87.     Interactor*, Interactor*, Coord x, Coord y, Alignment = BottomLeft
  88.     );
  89.  
  90.     void InsertToplevel(Interactor*, Interactor*);
  91.     void InsertToplevel(
  92.     Interactor*, Interactor*, Coord x, Coord y, Alignment = BottomLeft
  93.     );
  94.  
  95.     void InsertApplication(Interactor*);
  96.     void InsertApplication(
  97.     Interactor*, Coord x, Coord y, Alignment = BottomLeft
  98.     );
  99.  
  100.     void InsertIcon(Interactor*);
  101.     void InsertIcon(
  102.     Interactor*, Coord x, Coord y, Alignment = BottomLeft
  103.     );
  104.  
  105.     int Width();
  106.     int Height();
  107.     int NPlanes();
  108.     int NButtons();
  109.     int PixelSize();
  110.     Coord InvMapX(Coord);
  111.     Coord InvMapY(Coord);
  112.  
  113.     /* obsolete -- use Interactor::GetAttribute */
  114.     const char* GetDefault(const char*);
  115.     const char* GetGlobalDefault(const char*);
  116.  
  117.     /* returns bitset of Geom... flags */
  118.     unsigned int ParseGeometry(
  119.     const char*, Coord&, Coord&, unsigned int&, unsigned int&
  120.     );
  121.  
  122.     void SetHint(const char*);
  123.     void RingBell(int);
  124.     void SetKeyClick(int);
  125.     void SetAutoRepeat(boolean);
  126.     void SetFeedback(int thresh, int scale);
  127.  
  128.     void SetCurrent();
  129.     void SetRoot(void*);
  130.     void SetScreen(int);
  131. #ifdef _3D
  132.     void SetColorMap(unsigned long, class Canvas*);
  133. #endif
  134.     int Fileno();
  135.     class WorldRep* Rep () { return rep; }
  136. protected:
  137.     void DoInsert(Interactor*, boolean, Coord& x, Coord& y);
  138.     void DoChange(Interactor*);
  139.     void DoRemove(Interactor*);
  140. private:
  141.     friend void Interactor::DoSetGeometry();
  142.  
  143.     WorldRep* rep;
  144.  
  145.     void FinishInsert(Interactor*);
  146.     unsigned int GetGeometry(
  147.     Interactor*, Coord& x, Coord& y, unsigned int& w, unsigned int& h
  148.     );
  149.     void Init();
  150.     void FinishInit();
  151.     void LoadUserDefaults();
  152.     void ParseArgs(int&, char*[], OptionDesc[]);
  153.     void Setup(const char*, int, char*[]);
  154.     const char* UserDefaults();
  155.     void SaveCommandLine(int, char*[]);
  156. };
  157.  
  158. #endif
  159.